<html>
<head>
<title>Metacritic Search</title>
<style>
	HTML {
		height:100%;
	}

	BODY {
		background-color:#2e4659;
		height:100%;
		color:white;
		font-family:verdana;
		text-align:center;
	}

	DIV.container{
		width:900px;
		border:1px solid white;
		text-align:center;
		margin:auto;
		margin-bottom:20px;
	}
	
	DIV.result {
		width:900px;
		text-align:center;
		margin:auto;
	}
	
	LABEL {
		width:100%;
		float:left;
		font-weight:bold;
		font-size:30px;
	}

	DIV.platformSearch {	
		font-size:80px;
		width:100%;
	}
	
	INPUT.probe {
		height:100px;
		font-size:60px;
		text-transform:uppercase;
		line-height:80px;
	}
	
	SELECT {
		font-size:80px;	
		width:300px;
		text-align:center;
	}
	
	OPTION {
		font-size:80px;
	}
	
	INPUT.cerca {
		font-size:80px;
		text-transform:uppercase;
		border:1px solid 
	}
	
	DIV.header {
		text-align:center;
	}
	
	.medium {
		color:#333333;
		background-color:#FC3;
		width: 125px;
		height:125px;
		text-align:center;
		font-size:60px;
		text-align:center;
		display:block;
		line-height:125px;
		border:1px solid white;
	}
	
	.bad {
		background-color: #990000;
		border:1px solid white;
		color:white;
		width: 125px;
		height:125px;
		text-align:center;
		font-size:60px;
		text-align:center;
		display:block;
		line-height:125px;
	}
	
	
	.good {
		background-color: #6C3;
		color:white;
		width: 125px;
		height:125px;
		text-align:center;
		font-size:60px;
		text-align:center;
		display:block;
		line-height:125px;
		border:1px solid white;
	}
	
	DIV.itemContainer {
		position:relative;
		float:left;
		width:100%;
		margin-bottom:20px;
	}
	
	DIV.itemContainer IMG {
		height:125px;
		width:80px;
		border:1px solid white; 
	}
	
	DIV.itemContainer A{
		color:white;
		text-decoration:none;
	}
	
	DIV.titleBig {
		font-size:80px;
	}
	
	DIV.titleMedium {
		font-size:60px;
	}
	
	DIV.titleSmall {
		font-size:40px;
	}
	
	DIV.noItem {
		color:white;
		font-size:60px;
	}
	
	TD {
		text-align:left;
	}
	
</style>
</head>
<body>
<div class="header">
	<img src="./images/metacriticLogo.png" />
</div>
<?php 
	require ("class.metacritic.php");	
	require ('config.php');
	require ('proxy.php');
?>
<div class="container">
	<form method="post" action="index.php">
		<input type="hidden" name="action" value="1" />
		
		<div>
			<label>TITOLO</label>
			<input class="probe" type="text" size="20" name="probe" value="<?php if (isset($_POST['probe'])) echo $_POST['probe']; ?>"/>
		</div>
		<div class="platformSearch">
			<label>PIATTAFORMA</label>
			<select name="plats">
			   <?php 
			   	foreach ($platforms as $text=>$value){
			   		echo '<option value="'.$value.'">'.$text.'</option>';
			   	}
				?>
			</select>
		</div>
		<div>
			<input class="cerca" type="submit" value="cerca" />
		</div>
	</form>
</div>
<div class="result">
	<?php 
		global $proxy;
		if (isset($_POST['action'])){
			$mc = new metacritic();	
			echo $proxy;
			$mc->setProxy($proxy);
			$mc->setBaseUrl($metaCriticBaseUrl);
			$mc->setPlatformsSupport($platforms);
			$mc->setSheetUrl($metaCriticBaseSheetUrl);
			$mc->setCoverUrl($metaCriticBaseCoverUrl);
			
			$mc->setProbe($_POST['probe']);			
			$mc->setPlatform($_POST['plats']);
			$mc->getPage();
			$mc->parseCode();
			echo $mc->renderResult();
		}
	?>
</div>
</body>
</html>